package com.app.activity;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import com.app.R;
import com.app.model.response.ResObj;
import com.app.utils.LoginUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ActivitySetting extends ActivityBaseCompat {


    @BindView(R.id.rlNewmsgSetting)
    RelativeLayout rlNewmsgSetting;
    @BindView(R.id.rlChat)
    RelativeLayout rlChat;
    @BindView(R.id.rlPrivacy)
    RelativeLayout rlPrivacy;
    @BindView(R.id.rlCommon)
    RelativeLayout rlCommon;
    @BindView(R.id.rlSafety)
    RelativeLayout rlSafety;
    @BindView(R.id.rlAbout)
    RelativeLayout rlAbout;
    @BindView(R.id.rlExit)
    RelativeLayout rlExit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        ButterKnife.bind(this);
        setTitle("设置");
    }


    @Override
    public void onRequestSuccess(String url, ResObj result, boolean isFrmCache) {

    }

    @Override
    public void onRequestError(String url, int statusCode, String error) {

    }

    @OnClick({R.id.rlNewmsgSetting, R.id.rlChat, R.id.rlPrivacy, R.id.rlCommon, R.id.rlSafety, R.id.rlAbout, R.id.rlExit})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rlNewmsgSetting:
//                startActivity(new Intent(ActivitySetting.this, ActivityMsgSetting.class));
                break;
            case R.id.rlChat:
                break;
            case R.id.rlPrivacy:
                break;
            case R.id.rlCommon:
                break;
            case R.id.rlSafety:
                break;
            case R.id.rlAbout:
                break;
            case R.id.rlExit:
                AlertDialog.Builder builder = new AlertDialog.Builder(ActivitySetting.this);
                builder.setMessage("确认退出吗？");
                builder.setTitle("提示");
                builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        LoginUtil.logout();
                        dialog.dismiss();
                        startActivity(new Intent(ActivitySetting.this, ActivityLogin.class));
                    }
                });
                builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });
                builder.create().show();
                break;
        }
    }
}
